/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package plar.Properties;

/**
 *
 * @author spok
 */

import java.awt.Point;
import plar.*;
public class Gravity extends Property {

    private int gFactor;
    public Gravity(int f)
    {
     super("gravity");
     gFactor=f;
    }
    
    public boolean doElementProperty(Element e)
    {
          Boolean p = (Boolean) e.properties.get("gravity");
          if(p!=null && p==true)
          {
               Point oldSpeed = new Point((Point)e.properties.get("speed"));
               
               ((Point)e.properties.get("speed")).y+=5;
               level.callProperty("moveelements",e);
               e.properties.put("speed", new Point(oldSpeed));
               return true;
          }
          return false;
         
    }
}
